package com.renrendoc.network.flow;

import com.renrendoc.network.flow.beans.NginxLogEntry;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.client.program.StreamContextEnvironment;
import org.apache.flink.streaming.api.datastream.ConnectedStreams;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.ProcessFunction;

import java.io.UnsupportedEncodingException;
import java.net.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static com.renrendoc.network.flow.util.Common.parseQueryString;

public class Main {
    public static void main(String[] args) {
        String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36";


    }

    // 解析操作系统版本
    public static String parseOSVersion(String userAgent) {
        Pattern pattern = Pattern.compile("Windows NT (\\d+\\.\\d+)");
        Matcher matcher = pattern.matcher(userAgent);
        if (matcher.find()) {
            return "Windows " + matcher.group(1);
        } else {
            return "Unknown";
        }
    }

    // 解析浏览器版本
    public static String parseBrowserVersion(String userAgent) {
        Pattern pattern = Pattern.compile("Chrome/(\\d+\\.\\d+\\.\\d+)");
        Matcher matcher = pattern.matcher(userAgent);
        if (matcher.find()) {
            return "Chrome " + matcher.group(1);
        } else {
            return "Unknown";
        }
    }

}